﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FirmaTransportowa
{
    public class ManagerAddSalaryForm : Form
    {
        private Label label4;
        public DateTimePicker datePicker;
        private Label label2;
        public TextBox amountInput;
        public DataGridView activeWorkers;
        private Button addSalaryButton;
        private ManagerPanelPresenter presenter;

        public ManagerAddSalaryForm(ManagerPanelPresenter presenter)
        {
            this.presenter = presenter;
            InitializeComponent();
            this.Show();
        }

        public void showDataTable()
        {
            activeWorkers.Columns[0].HeaderText = "ID pracownika";
            activeWorkers.Columns[1].HeaderText = "Imię";
            activeWorkers.Columns[2].HeaderText = "Nazwisko";
            activeWorkers.Columns[3].HeaderText = "Data urodzenia";
            activeWorkers.Columns[4].HeaderText = "PESEL";
            activeWorkers.Columns[5].HeaderText = "ID zawodu";
            activeWorkers.Columns[0].Width = 80;
            activeWorkers.Columns[1].Width = 100;
            activeWorkers.Columns[2].Width = 100;
            activeWorkers.Columns[3].Width = 100;
            activeWorkers.Columns[4].Width = 100;
            activeWorkers.Columns[5].Width = 60;
        }

        private void InitializeComponent()
        {
            this.label4 = new System.Windows.Forms.Label();
            this.datePicker = new System.Windows.Forms.DateTimePicker();
            this.label2 = new System.Windows.Forms.Label();
            this.amountInput = new System.Windows.Forms.TextBox();
            this.activeWorkers = new System.Windows.Forms.DataGridView();
            this.addSalaryButton = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.activeWorkers)).BeginInit();
            this.SuspendLayout();
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(155, 253);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(73, 13);
            this.label4.TabIndex = 10;
            this.label4.Text = "Data wypłaty:";
            // 
            // datePicker
            // 
            this.datePicker.Location = new System.Drawing.Point(245, 247);
            this.datePicker.Name = "datePicker";
            this.datePicker.Size = new System.Drawing.Size(164, 20);
            this.datePicker.TabIndex = 9;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(188, 289);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(40, 13);
            this.label2.TabIndex = 12;
            this.label2.Text = "Kwota:";
            // 
            // amountInput
            // 
            this.amountInput.Location = new System.Drawing.Point(245, 286);
            this.amountInput.Name = "amountInput";
            this.amountInput.Size = new System.Drawing.Size(164, 20);
            this.amountInput.TabIndex = 11;
            // 
            // activeWorkers
            // 
            this.activeWorkers.AllowUserToAddRows = false;
            this.activeWorkers.AllowUserToDeleteRows = false;
            this.activeWorkers.AllowUserToResizeColumns = false;
            this.activeWorkers.AllowUserToResizeRows = false;
            this.activeWorkers.BackgroundColor = System.Drawing.SystemColors.Window;
            this.activeWorkers.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.activeWorkers.Location = new System.Drawing.Point(12, 12);
            this.activeWorkers.Name = "activeWorkers";
            this.activeWorkers.ReadOnly = true;
            this.activeWorkers.Size = new System.Drawing.Size(604, 204);
            this.activeWorkers.TabIndex = 13;
            // 
            // addSalaryButton
            // 
            this.addSalaryButton.Location = new System.Drawing.Point(245, 325);
            this.addSalaryButton.Name = "addSalaryButton";
            this.addSalaryButton.Size = new System.Drawing.Size(164, 23);
            this.addSalaryButton.TabIndex = 14;
            this.addSalaryButton.Text = "dodaj wypłatę";
            this.addSalaryButton.UseVisualStyleBackColor = true;
            this.addSalaryButton.Click += new System.EventHandler(this.addSalaryButton_Click);
            // 
            // ManagerAddSalaryForm
            // 
            this.ClientSize = new System.Drawing.Size(628, 375);
            this.Controls.Add(this.addSalaryButton);
            this.Controls.Add(this.activeWorkers);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.amountInput);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.datePicker);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.HelpButton = true;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ManagerAddSalaryForm";
            this.Text = "Nowe wynagrodzenie";
            this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.ManagerAddSalaryForm_HelpButtonClicked);
            ((System.ComponentModel.ISupportInitialize)(this.activeWorkers)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private void addSalaryButton_Click(object sender, EventArgs e)
        {
            presenter.addSalary();
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.F1)
            {
                HelpUtils.showHelp(this, 28);
                return true;
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

        private void ManagerAddSalaryForm_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e)
        {
            HelpUtils.showHelp(this, 28);
        }
    }
}
